﻿using System;
using System.Collections.Generic;
using System.Text;
using AgilePlannerDT.Data;

namespace AgilePlannerDT.Application.Commands.Impl
{
    public class StoryCardMoveToNewParentCommand : ApCommandImpl
    {
        StoryCard before, after;

        public StoryCardMoveToNewParentCommand(AgilePlannerApplication app, StoryCard before, StoryCard after)
            : base(app)
        {
            this.before = before;
            this.after = after;
        }

        public override void Undo()
        {
            if (!isUndone)
            {
                app.Persister.MoveStoryCardToNewParent(after, before.Parent, (int)before.LocationX, (int)before.LocationY, (float)before.RotationAngle);
                base.Undo();
            }
        }

        public override void Redo()
        {
            if (IsUndone)
            {
                app.Persister.MoveStoryCardToNewParent(before, after.Parent, (int)after.LocationX, (int)after.LocationY, (float)after.RotationAngle);
                base.Redo();
            }
        }

    }
}
